﻿using CleanArchitecture.Infrastructure.Entities;
using CleanArchitecture.Infrastructure.Entities.AdminUsers;
using CleanArchitecture.Infrastructure.Entities.SystemModules;
using CleanArchitecture.Infrastructure.Models.Business.Columns;
using CleanArchitecture.Infrastructure.Models.SystemManage;
using System.Collections.Generic;

namespace CleanArchitecture.Infrastructure.Interfaces.Security
{
    /// <summary>
    /// DavidLee 2020/01/04 重新构架分类权限
    /// 所有系统模块均通过数据字典模块分配操作按钮，再通过角色分配按钮操作权限
    /// </summary>
    public partial interface IPermissionService
    {
        /// <summary>
        /// Authorize permission of SystemModule(Navi Menu)
        /// </summary>
        /// <param name="moduleUri">moduleUri Route</param>
        /// <returns>true - authorized; otherwise, false</returns>
        bool Authorize(SystemModule module);
        /// <summary>
        /// Authorize permission of SystemModule Button
        /// </summary>
        /// <param name="moduleId"></param>
        /// <param name="buttonId"></param>
        /// <returns></returns>
        bool AuthorizeModuleButton(int moduleId, int buttonId);
        bool ColumnAuthorize(int ColumnId);
        bool AuthorizeColumnButton(int columnId, int buttonId);
        /// <summary>
        /// 查询分配给系统模块的所有操作按钮
        /// </summary>
        /// <param name="moduleId"></param>
        /// <returns></returns>
        IList<SystemDataDicButtonModel> GetSystemModuleAssignedButtons(string moduleUri);
        /// <summary>
        /// 根据角色Id查询系统模块所分配的权限
        /// </summary>
        /// <param name="roleId"></param>
        /// <returns></returns>
        IList<SystemModuleModel> GetAuthorizedSystemModulesByAdminRoleId(AdminRole role);
        
        IList<ColumnAthorizedModel> GetColumnAuthorizeData(AdminRole role, EntityEnumConfig.ColumnType columnType);
    }
}
